home *** CD-ROM | disk | FTP | other *** search
- package Local.Game.Thing
- {
- import Local.Game.World.CPosition;
- import Local.Game.World.Map.CMap;
- import Local.Game.World.Map.Cell.CCell;
- import flash.geom.Point;
-
- public class CThingMap extends CThingDraw
- {
-
- public static const CURRENTCELL_CHANGED:String = "CURRENTCELL_CHANGED";
-
- public static const mBloatCellSearch:Number = CMap.mCellSize * 3;
-
-
- public var mCellCurrent:CCell;
-
- public var mShowOnMap:Boolean;
-
- public var mCollide:CTCollide;
-
- public function CThingMap()
- {
- super();
- }
-
- public function Move(param1:CPosition) : Boolean
- {
- if(true)
- {
- mPosition.x += param1.x;
- mPosition.y += param1.y;
- }
- return MapMove();
- }
-
- override public function Dispose() : void
- {
- if(mDisposed)
- {
- return;
- }
- if(mCellCurrent)
- {
- MapRemove();
- }
- super.Dispose();
- }
-
- public function _validThing(param1:int) : Boolean
- {
- return mGroupID == param1 || mCollide == null || mDead ? false : true;
- }
-
- public function MapMove() : Boolean
- {
- §§push(mCellCurrent);
- if(true)
- {
- §§push(§§pop().InCell(mPosition.x));
- if(true)
- {
- if(§§pop())
- {
- return false;
- }
- addr28:
- mCellCurrent.RemoveThing(this);
- mCellCurrent = mMap.AddThing(this);
- §§push(true);
- }
- return §§pop();
- }
- §§goto(addr28);
- }
-
- public function GetAltitude(param1:Number) : Number
- {
- return mLandscape.GetAltitude(param1);
- }
-
- public function GetThings_Radius(param1:Number, param2:int = 10000) : Array
- {
- var _loc3_:Array = null;
- var _loc4_:Number = NaN;
- var _loc5_:CCell = null;
- var _loc6_:CThingMain = null;
- _loc3_ = new Array();
- _loc4_ = param1 + mBloatCellSearch;
- for each(_loc5_ in mMap.GetCells(mPosition.x - _loc4_,mPosition.x + _loc4_))
- {
- if(true)
- {
- var _loc9_:int = 0;
- if(true)
- {
- for each(_loc6_ in _loc5_.mMapwho)
- {
- if(_loc6_._validThing(mGroupID))
- {
- if(Point.distance(mPosition,_loc6_.mPosition) <= param1)
- {
- if(_loc3_.push(_loc6_) == param2)
- {
- return _loc3_;
- }
- }
- }
- }
- }
- }
- }
- return _loc3_;
- }
-
- public function GetPosition() : CPosition
- {
- return mPosition;
- }
-
- public function GetThings_Distance(param1:Number, param2:int = 10000) : Array
- {
- var _loc3_:Array = null;
- var _loc4_:CCell = null;
- var _loc5_:CThingMain = null;
- _loc3_ = new Array();
- loop0:
- for each(_loc4_ in mMap.GetCells(mPosition.x,mPosition.x + (param1 + mBloatCellSearch) * mOrientation))
- {
- if(true)
- {
- var _loc8_:int = 0;
- var _loc9_:* = _loc4_.mMapwho;
- loop1:
- while(true)
- {
- for each(_loc5_ in _loc9_)
- {
- if(!_loc5_._validThing(mGroupID))
- {
- if(true)
- {
- }
- }
- else if(Point.distance(mPosition,_loc5_.mPosition) > param1)
- {
- if(false)
- {
- break loop1;
- }
- }
- else if(_loc3_.push(_loc5_) == param2)
- {
- break loop1;
- }
- }
- continue loop0;
- }
- return _loc3_;
- }
- }
- return _loc3_;
- }
-
- public function GetThings_Line(param1:CPosition, param2:CPosition, param3:int = 10000) : Array
- {
- var _loc4_:Array = null;
- var _loc5_:CCell = null;
- var _loc6_:CThingMain = null;
- _loc4_ = new Array();
- var _loc7_:int = 0;
- if(true)
- {
- for each(_loc5_ in param1.x > param2.x ? mMap.GetCells(param1.x + mBloatCellSearch,param2.x - mBloatCellSearch) : mMap.GetCells(param1.x - mBloatCellSearch,param2.x + mBloatCellSearch))
- {
- for each(_loc6_ in _loc5_.mMapwho)
- {
- if(_loc6_._validThing(mGroupID))
- {
- if(_loc6_.mCollide.CollideLine(param1,param2,true))
- {
- if(_loc4_.push(_loc6_) == param3)
- {
- return _loc4_;
- }
- }
- }
- }
- }
- return _loc4_;
- }
- §§goto(addr31);
- }
-
- public function MapAdd() : void
- {
- if(true)
- {
- mCellCurrent = mMap.AddThing(this);
- }
- }
-
- public function MapRemove() : void
- {
- mCellCurrent.RemoveThing(this);
- mCellCurrent = null;
- }
-
- public function GetDrawPosition() : Point
- {
- return new Point(mPosition.x - mLandscape.mDrawPosition.x,mPosition.y - mLandscape.mDrawPosition.y);
- }
- }
- }
-